package org.tacademy.scrollview;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ScrollView;

public class MyScrollVeiwActivity extends Activity {

	ImageView imageView01;
	ScrollView scrollView01;
	
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        imageView01 = (ImageView) findViewById(R.id.imageView01);
        scrollView01 = (ScrollView) findViewById(R.id.scrollView01);
        scrollView01.setHorizontalScrollBarEnabled(true);
        
        Resources res = getResources();
        BitmapDrawable bitmap = (BitmapDrawable) res.getDrawable(R.drawable.activity_lifecycle); // drawable->bitmapdrawable down casting
        
        int bitmapWidth = bitmap.getIntrinsicWidth();
        int bitmapHeight = bitmap.getIntrinsicHeight();
        
        imageView01.setImageDrawable(bitmap);
        imageView01.getLayoutParams().width = bitmapWidth;
        imageView01.getLayoutParams().height = bitmapHeight;
        
        
        Button button01 = (Button) findViewById(R.id.button01);
        button01.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				changeImage();
			}
		});
        
    }
    
    public void changeImage(){
    	
    	
    	
    }
}








